  $(function() {
		$("#li1").addClass("backgroundTab");
	  });
		var menu1 = $("#menu1");
		var menu2 = $("#menu2");
		var menu3 = $("#menu3");
		var li1 = $("#li1");
		var li2 = $("#li2");
		var li3 = $("#li3");
	
		
		var li = null;
		var li1IsClick = true;
		var li2IsClick = true;
		var li3IsClick = true;
		if (data[2].listMenus.length == 0) {
			//$("#li3").hide();
			li3IsClick = false;
		}else{
			li = 3;
		}
		if (data[1].listMenus.length == 0) {
			//$("#li2").hide();
			li2IsClick = false;
		} else {
			li = 2;
		}
		if (data[0].listMenus.length == 0) {
			//$("#li1").hide();
			li1IsClick = false;
		} else {
			li = 1;
		}
	
		menu1.innerText = data[0].menuName;
		menu2.innerText = data[1].menuName;
		menu3.innerText = data[2].menuName;
	
		function menu1Click(){
			if(!li1IsClick){
				return;
			}
			$(".h_middle").find("li").removeClass("backgroundTab"); 
			clickColor(); 
			$(li1).addClass("backgroundTab");
			self.parent.mainFrame.menuFrame.modelMenu({
				"menuId" : data[0].menuId,
				"userId" : userId,
				"firstMenu" : data[0].listMenus[0].listMenus[0].menuId
			},allMenus);
			var url = data[0].listMenus[0].listMenus[0].menuUrl;
			self.parent.mainFrame.welcomeFrame.location = basePath+url;
		}
		function menu2Click() {
			if(!li2IsClick){
				return;
			}
			$(".h_middle").find("li").removeClass("backgroundTab"); 
			clickColor(); 
			$(li2).addClass("backgroundTab");
			self.parent.mainFrame.menuFrame.modelMenu({
				"menuId" : data[1].menuId,
				"userId" : userId,
				"firstMenu" : data[1].listMenus[0].listMenus[0].menuId
			},allMenus);
			$("#tree").find("a:first")
			var url = data[1].listMenus[0].listMenus[0].menuUrl;
			self.parent.mainFrame.welcomeFrame.location = basePath+url;
	
		}
		function menu3Click() {
			if(!li3IsClick){
				return;
			}
			 $(".h_middle").find("li").removeClass("backgroundTab"); 
			 clickColor(); 
			$(li3).addClass("backgroundTab");
			self.parent.mainFrame.menuFrame.modelMenu({
				"menuId" : data[2].menuId,
				"userId" : userId,
				"firstMenu" : data[2].listMenus[0].listMenus[0].menuId
			},allMenus);
			var url = data[2].listMenus[0].listMenus[0].menuUrl;
			self.parent.mainFrame.welcomeFrame.location = basePath + url;
    }

    function exitUser() {
        $.ajax({
            url : "user/exitUser",
            success : function() {
            	self.parent.parent.location = basePath;
                
            }
        });
    }
    var li1 = document.getElementById("li1");

    $("#li1").click(function() {
        menu1Click();
    });
    $("#li2").click(function() {
        menu2Click();
    });
    $("#li3").click(function() {
        menu3Click();
    });
    $("#li4").click(function() {
        exitUser();
    });
    function clickColor() {
    	document.getElementById("li1").setAttribute("class","");
    	document.getElementById("li2").setAttribute("class","");
    	document.getElementById("li3").setAttribute("class","");

    }